<?php
/**
 * Created by PhpStorm.
 * User: 12133
 * Date: 2024/3/18
 * Time: 10:02
 */

namespace app\model\admin;


use think\model\concern\SoftDelete;

class Order extends Base
{
    use SoftDelete;
    protected $append = [
        'status_text',
        'type_text',
        'price_text'
    ];
    public function info(){
        return $this->hasMany(OrderInfo::class,'order_no','order_no');
    }
    public function getStatusTextAttr($value,$data){
        $array = [
            1 => '未补完',
            2 => '未支付',
            3 => '已支付',
            4 => '完成'
        ];
        return $array[$data['status']];
    }
    public function getTypeTextAttr($value,$data){
        $array = [
            1 => '全部',
            2 => 'PC端',
            3 => '手机端'
        ];
        return $array[$data['type']];
    }
    public function getPriceTypeTextAttr($value,$data){
        $array = [
            1 => '基础',
            2 => 'OCPC'
        ];
        return $array[$data['price_type']];
    }
}